var a = getApp();

Page({
    data: {
        show: !1,
        infoData: [],
        agreementUrl: "",
        status: !1,
        income_name_text: wx.getStorageSync("yz_basic_info").lang.income.income_name ? wx.getStorageSync("yz_basic_info").lang.income.income_name : "收入",
        BalanceName: "",
        name_of_withdrawal: wx.getStorageSync("yz_basic_info").lang.income.name_of_withdrawal ? wx.getStorageSync("yz_basic_info").lang.income.name_of_withdrawal : "提现"
    },
    onLoad: function(a) {
        this.checkAgreement(), wx.setNavigationBarTitle({
            title: "".concat(this.data.name_of_withdrawal, "到银行卡-智E+")
        });
    },
    toBindCard: function() {
        wx.navigateTo({
            url: "/packageF/others/wisdom/addWisdomBank/addWisdomBank?to=wisdomBindTask"
        });
    },
    tobind: function(a) {
        if ("phone" == a.currentTarget.dataset.key) {
            if ("1" == this.data.infoData.is_bind_mobile) return;
            wx.navigateTo({
                url: "/packageF/others/wisdom/wisdomBind/wisdomBind?option=phone"
            });
        } else {
            if ("1" == this.data.infoData.is_auth) return;
            wx.navigateTo({
                url: "/packageF/others/wisdom/wisdomBind/wisdomBind?option=auth"
            });
        }
    },
    toUrl: function() {
        0 == this.data.infoData.is_agreement && (console.log(this.data.agreementUrl), wx.navigateTo({
            url: "/packageI/web-view/h5View?isEplus=true"
        }));
    },
    tapWithdrawal: function(a) {
        var t = a.currentTarget.dataset.key;
        this.data.status && ("balance" == t ? wx.navigateTo({
            url: "/packageA/member/balance/balance_withdrawals/balance_withdrawals"
        }) : wx.navigateTo({
            url: "/packageA/member/withdrawal/withdrawal"
        }));
    },
    getData: function() {
        var t = this, e = a.getNetAddresss("plugin.eplus-pay.frontend.index.index");
        a._getNetWork({
            url: e,
            success: function(e) {
                var n = e.data;
                1 == n.result ? (t.data.infoData = n.data, t.setData({
                    infoData: t.data.infoData
                }), "1" == t.data.infoData.is_auth && "1" == t.data.infoData.is_agreement && "1" == t.data.infoData.is_bind_mobile ? t.setData({
                    status: !0
                }) : t.setData({
                    status: !1
                }), 0 == t.data.infoData.is_agreement && t.getAgreementUrl()) : a.tips(n.msg);
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    getAgreementUrl: function() {
        var t = this, e = a.getNetAddresss("plugin.eplus-pay.frontend.agreement.agreementUrl");
        a._getNetWork({
            url: e,
            success: function(e) {
                var n = e.data;
                1 == n.result ? t.setData({
                    agreementUrl: n.data.url
                }) : a.tips(n.msg);
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    checkAgreement: function() {
        var t = this, e = a.getNetAddresss("plugin.eplus-pay.frontend.agreement.confirmAgreement");
        a._getNetWork({
            url: e,
            success: function(a) {
                1 == a.data.result && t.setData({
                    "infoData.is_agreement": 1
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    onReady: function() {},
    onShow: function() {
        this.getData();
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});